package com.guoqing.example.controller;

import org.activiti.engine.*;
import org.activiti.engine.repository.DeploymentBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ActivityController {

    /**
     * act_re_procdef
     * act_re_model
     * act_re_deployment
     * act_ge_bytearray
     */
    @Autowired
    private RepositoryService repositoryService;
    /**
     * 流程运行增删改查
     *  act_ru_*
     */
    @Autowired
    private RuntimeService runtimeService;
    /**
     *
     */
    @Autowired
    private TaskService taskService;
    /**
     * 流程历史数据的操作
     * act_hi_*
     */
    @Autowired
    private HistoryService historyService;
    /**
     * 对工作流的用户管理表的操作
     * act_id_*
     */
    @Autowired
    private IdentityService identityService;

    @RequestMapping("/testActivity")
    public String testActivity(){
        long count = repositoryService.createDeploymentQuery().count();
        return String.valueOf(count);
    }

    // 部署流程
    public void deployProcess(String deployProcessName){
        DeploymentBuilder name = repositoryService.createDeployment().name(deployProcessName);
    }
}
